package com.zb.util;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/5/19.
 */
public class SelectItemImpl implements SelectItem
{
	private String code;
	private String description;

	public SelectItemImpl(SelectItem s)
	{
		this.code = s.getCode();
		this.description = s.getDescription();
	}

	public static List<SelectItemImpl> convert(SelectItem[] items)
	{
		if(items == null || items.length == 0)
			return null;
		List<SelectItemImpl> list = new ArrayList<>();
		for(SelectItem item : items)
		{
			list.add(new SelectItemImpl(item));
		}
		return list;
	}

	public static List<SelectItemImpl> convert(List<? extends SelectItem> items)
	{
		if(items == null || items.size() == 0)
			return null;
		List<SelectItemImpl> list = new ArrayList<>();
		for(SelectItem item : items)
		{
			list.add(new SelectItemImpl(item));
		}
		return list;
	}

	@Override
	public String getCode()
	{
		return code;
	}

	@Override
	public String getDescription()
	{
		return description;
	}
}
